<?php
class Add extends PageBaseUpdate {

	protected function InitializeComponent(){
		$this->ClassName = "Usuario";
		$this->AddKeyField("id", "IDUSUARIO");
		$this->AddControlToField("txtnombreyapellido", "NOMBREYAPELLIDO");
		$this->AddControlToField("txtUsuario", "USERNAME");
		$this->AddControlToField("txtContrasena", "PASSWORD");
		$this->AddControlToField("dropDownListRol", "IDROL");
		$this->Back("SetBackPage", "?page=Admin.Usuario.Home");
	}

	// Necesario por se un metodo abstracto en el padre
	protected function LoadDataRelated(){
       	$c = new Criteria();
       	$c->addAscendingOrderByColumn(RolPeer::NOMBRE);
		$this->LoadDdl(
			"Rol",
			"dropDownListRol",
			"Idrol",
			"Nombre",
			"0",
			"Seleccione rol",
			"0",
			$c
		);
	}

	protected function buttonActualizar_onClick(){
		if($this->IsValid){
        	$this->Save("GoBackPage");
			$this->Back("GoBackPage");
		}
	}

    public function buttonCancel_OnClick()
    {
        $this->Back("GoBackPage");
    }
}
?>